/*******************************************************************************
 * Copyright (c) 2014 Francesco Gabbrielli (http://www.francescogabbrielli.it).
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v2.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     Francesco Gabbrielli - initial API and implementation
 ******************************************************************************/
package it.francescogabbrielli.android.solidalapp;

import javax.jdo.annotations.NotPersistent;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

@MappedSuperclass
/** Need not to be astract for use in endpoints */
public class Message extends Operation {
	
	/** Message id field */
	public final static String ID = "id";
	/** Id of device that sends the message */
	public final static String DEVICE_ID = "deviceId";
	/** Message text field */
	public final static String MESSAGE = "message";
	/** Message sender field */
	public final static String SENDER = "sender";
	/** Message sender id field */
	public final static String SENDER_ID = "senderId";
	/** Message type field */
	public final static String TYPE = "mtype";
	
	/** Message type value when GCM registration id changes */
	public final static String TYPE_REG_UPDATE = "reg_update";
	
	
	/** fake id */
	@NotPersistent
	@Transient
	private Long id;
		
	/** The message */
	private String message;
	
	/** Username of sender */
	private String sender;
	
	/** The sender id (profile) */
	private long senderId;
	
	/** The id of the device that started this response (required) */
	private long deviceId;
	
	/** If location was edited by hand */
	private boolean manualLocation;
	
	public Message() {
		this.id = Long.valueOf(0);
	}
	
	public Message(long id) {
		this.id = id;
	}
	
	/** Override this */
	public Long getId() {
		return id;
	}
	
	public String getMessage() {
		return message;
	}
	
	public void setMessage(String message) {
		this.message = message;
	}
	
	public String getSender() {
		return sender;
	}
	
	public void setSender(String sender) {
		this.sender = sender;
	}
	
	public long getSenderId() {
		return senderId;
	}
	
	public void setSenderId(long id) {
		this.senderId = id;
	}
	
	public long getDeviceId() {
		return deviceId;
	}
	
	public void setDeviceId(long deviceId) {
		this.deviceId = deviceId;
	}
	
	public boolean isManualLocation() {
		return manualLocation;
	}
	
	public void setManualLocation(boolean manualLocation) {
		this.manualLocation = manualLocation;
	}

}
